package drds.server.sqlparser.sqlobject.statement.query;

import drds.server.sqlparser.sqlobject.AbstractSqlObject;
import drds.server.sqlparser.sqlobject.expression.Expression;
import drds.server.sqlparser.visitor.Visitor;

/**
 * 
 * @author 曹正辉<330937205@qq.com>
 * 
 */
public class Limit extends AbstractSqlObject {
	private Expression offset;
	private Expression count;

	public Limit() {

	}

	public void setCount(Expression count) {
		if (count != null) {
			count.setParent(this);
		}
		this.count = count;
	}

	public Expression getCount() {
		return count;
	}

	public void setOffset(Expression offset) {
		if (offset != null) {
			offset.setParent(this);
		}
		this.offset = offset;
	}

	public Expression getOffset() {
		return offset;
	}

	@Override
	protected void accept0(Visitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, offset);
			acceptChild(visitor, count);
		}
		visitor.endVisit(this);
	}

}
